version = 2
root = "{{ containerd_storage_dir }}"
state = "{{ containerd_state_dir }}"
oom_score = {{ containerd_oom_score }}

[debug]
  level = "{{ containerd_debug_level | default("") }}"

[grpc]
{% for param, value in containerd_config_grpc.items() %}
  {{ param }} = {{ value }}
{% endfor %}

[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
    stream_server_address = "127.0.0.1"
    max_container_log_line_size = {{ containerdmax_container_log_line_size }}
    sandbox_image = "{{ pod_infra_container_image }}"
    systemd_cgroup = {{ containerd_use_systemd_cgroup | default(true) |lower }}
    [plugins."io.containerd.grpc.v1.cri".containerd]
{% for param, value in containerd_plugins_cri_containerd.items() %}
      {{ param }} = {{ value }}
{% endfor %}
      [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]
        runtime_type = "{{ containerd_default_runtime.type }}"
        runtime_engine = "{{ containerd_default_runtime.engine }}"
        runtime_root = "{{ containerd_default_runtime.root }}"
      [plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime]
        runtime_type = "{{ containerd_untrusted_workload_runtime.type }}"
        runtime_engine = "{{ containerd_untrusted_workload_runtime.engine }}"
        runtime_root = "{{ containerd_untrusted_workload_runtime.root }}"
      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
{% for runtime in containerd_runtimes %}
        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.{{ runtime.name }}]
          runtime_type = "{{ runtime.type }}"
          runtime_engine = "{{ runtime.engine }}"
          runtime_root = "{{ runtime.root }}"
{% endfor %}
        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
          SystemdCgroup = {{ containerd_use_systemd_cgroup | default(true) |lower }}
    [plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
{% for registry, addr in containerd_plugins_cri_registries_mirrors.items() %}
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."{{ registry }}"]
          endpoint = ["{{ ([ addr ] | flatten ) | join('","') }}"]
{% endfor %}